package com.chhuang.core.injector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
import com.chhuang.core.method.Select1Limit1;

import java.util.List;

/**
 * @ClassName ChSqlInjector
 * @Description 实现SqlInjector
 * @Author Darren Huang
 * @Date 2022/11/24 0:31
 * @Version 1.0
 */
public class ChSqlInjector extends DefaultSqlInjector {

    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        methodList.add(new Select1Limit1());
        methodList.add(new InsertBatchSomeColumn());//批量插入
        return methodList;

//        Stream.Builder<AbstractMethod> builder = Stream.<AbstractMethod>builder()
//                .add(new Select1Limit1());
//        return builder.build().collect(toList());
    }
}
